<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Welcome</title>
<script type="text/javascript">
	function confirmAction() {
		return confirm("Are you sure to delete this user ?")
	}
</script>
</head>

<body>
	<div id="functionLabel">
		<p>User managerment</p>
	</div>

	<table id="customers">
		<tr>
			<th scope="col"><s:text name="manageruser.username" /></th>
			<th scope="col"><s:text name="manageruser.fullName" /></th>
			<th scope="col"><s:text name="manageruser.isAdmin" /></th>
			<th scope="col"><s:text name="manageruser.editUser" /></th>
			<th scope="col"><s:text name="manageruser.deleteUser" /></th>
		</tr>

		<s:iterator value="listUsers" id="listUsers" status="user">
			<tr>
				<s:if test="#user.even == true">
					<tr class="evenRow">
				</s:if>
				<s:else>
					<tr class="oddRow">
				</s:else>
				<td><s:property value="username" /></td>
				<td><s:property value="fullName" /></td>
				<td><s:if test="isAdmin == true">
						Yes
					</s:if> <s:else>
						No
					</s:else></td>
				<td><s:url id="editUrl" action="editUser">
						<s:param name="id" value="%{userId}"></s:param>
					</s:url> <s:a cssClass="editLink" href="%{editUrl}">
					</s:a></td>
				<td><s:url id="deleteUrl" action="deleteUser">
						<s:param name="id" value="%{userId}"></s:param>
					</s:url> <s:a cssClass="delLink" href="%{deleteUrl}"
						onclick="return confirmAction()"></s:a></td>
			</tr>
		</s:iterator>

	</table>
		<div id="customers">
			<s:a cssClass="button-link" href="addUser">Add a user</s:a>
		</div>	

</body>
</html>